﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes.mysql;

namespace SharpSqlAnalyzer.nodes
{
	// Token: 0x0200029B RID: 667
	public class TConstraint : TParseTreeNode
	{
		// Token: 0x1700040C RID: 1036
		// (get) Token: 0x0600159A RID: 5530 RVA: 0x00326475 File Offset: 0x00324675
		// (set) Token: 0x0600159B RID: 5531 RVA: 0x0032647D File Offset: 0x0032467D
		public TObjectName DefaultForColumnName
		{
			get
			{
				return this._forName;
			}
			set
			{
				this._forName = value;
			}
		}

		// Token: 0x1700040D RID: 1037
		// (get) Token: 0x0600159D RID: 5533 RVA: 0x0032648F File Offset: 0x0032468F
		// (set) Token: 0x0600159C RID: 5532 RVA: 0x00326486 File Offset: 0x00324686
		public List<TMySQLIndexOption> IndexOptionList
		{
			get
			{
				return this._indexOptionList;
			}
			set
			{
				this._indexOptionList = value;
			}
		}

		// Token: 0x0600159E RID: 5534 RVA: 0x00326497 File Offset: 0x00324697
		public void setKeyActions(List<TKeyAction> ka)
		{
			this._keyActions = ka;
		}

		// Token: 0x0600159F RID: 5535 RVA: 0x003264A0 File Offset: 0x003246A0
		public void setReferencedColumnList(TObjectNameList onl)
		{
			this._referencedColumnList = onl;
		}

		// Token: 0x060015A0 RID: 5536 RVA: 0x003264A9 File Offset: 0x003246A9
		public void setReferencedObject(TObjectName on)
		{
			this._referencedObject = on;
		}

		// Token: 0x060015A1 RID: 5537 RVA: 0x003264B2 File Offset: 0x003246B2
		public void setConstraint_type(EConstraintType ct)
		{
			this._constraint_type = ct;
		}

		// Token: 0x060015A2 RID: 5538 RVA: 0x003264BB File Offset: 0x003246BB
		public void setConstraintName(TObjectName on)
		{
			this._constraintName = on;
		}

		// Token: 0x1700040E RID: 1038
		// (get) Token: 0x060015A3 RID: 5539 RVA: 0x003264C4 File Offset: 0x003246C4
		// (set) Token: 0x060015A4 RID: 5540 RVA: 0x003264CC File Offset: 0x003246CC
		public TConstant constraintComment
		{
			get
			{
				return this._constraintComment;
			}
			set
			{
				this._constraintComment = value;
			}
		}

		// Token: 0x1700040F RID: 1039
		// (get) Token: 0x060015A6 RID: 5542 RVA: 0x003264DE File Offset: 0x003246DE
		// (set) Token: 0x060015A5 RID: 5541 RVA: 0x003264D5 File Offset: 0x003246D5
		public virtual List<TKeyAction> KeyActions
		{
			get
			{
				return this._keyActions;
			}
			set
			{
				this._keyActions = value;
			}
		}

		// Token: 0x17000410 RID: 1040
		// (get) Token: 0x060015A8 RID: 5544 RVA: 0x003264EF File Offset: 0x003246EF
		// (set) Token: 0x060015A7 RID: 5543 RVA: 0x003264E6 File Offset: 0x003246E6
		public virtual int ConstraintLevel
		{
			get
			{
				return this._constraintLevel;
			}
			set
			{
				this._constraintLevel = value;
			}
		}

		// Token: 0x17000411 RID: 1041
		// (get) Token: 0x060015AA RID: 5546 RVA: 0x00326500 File Offset: 0x00324700
		// (set) Token: 0x060015A9 RID: 5545 RVA: 0x003264F7 File Offset: 0x003246F7
		public virtual TExpression DefaultExpression
		{
			get
			{
				return this._defaultExpression;
			}
			set
			{
				this._defaultExpression = value;
			}
		}

		// Token: 0x17000412 RID: 1042
		// (get) Token: 0x060015AC RID: 5548 RVA: 0x00326511 File Offset: 0x00324711
		// (set) Token: 0x060015AB RID: 5547 RVA: 0x00326508 File Offset: 0x00324708
		public virtual TObjectName ConstraintName
		{
			get
			{
				return this._constraintName;
			}
			set
			{
				this._constraintName = value;
			}
		}

		// Token: 0x17000413 RID: 1043
		// (get) Token: 0x060015AE RID: 5550 RVA: 0x00326522 File Offset: 0x00324722
		// (set) Token: 0x060015AD RID: 5549 RVA: 0x00326519 File Offset: 0x00324719
		public virtual EConstraintType Constraint_type
		{
			get
			{
				return this._constraint_type;
			}
			set
			{
				this._constraint_type = value;
			}
		}

		// Token: 0x17000414 RID: 1044
		// (get) Token: 0x060015B0 RID: 5552 RVA: 0x00326533 File Offset: 0x00324733
		// (set) Token: 0x060015AF RID: 5551 RVA: 0x0032652A File Offset: 0x0032472A
		public virtual bool Clustered
		{
			get
			{
				return this._clustered;
			}
			set
			{
				this._clustered = value;
			}
		}

		// Token: 0x17000415 RID: 1045
		// (set) Token: 0x060015B1 RID: 5553 RVA: 0x0032653B File Offset: 0x0032473B
		public virtual TSourceToken ClusteredToken
		{
			set
			{
				if (value == null)
				{
					return;
				}
				if (value.ToString().Equals("clustered", StringComparison.CurrentCultureIgnoreCase))
				{
					this._clustered = true;
					return;
				}
				if (value.ToString().Equals("nonclustered", StringComparison.CurrentCultureIgnoreCase))
				{
					this._nonClustered = true;
				}
			}
		}

		// Token: 0x17000416 RID: 1046
		// (get) Token: 0x060015B2 RID: 5554 RVA: 0x00326576 File Offset: 0x00324776
		// (set) Token: 0x060015B3 RID: 5555 RVA: 0x0032657E File Offset: 0x0032477E
		public virtual bool NonClustered
		{
			get
			{
				return this._nonClustered;
			}
			set
			{
				this._nonClustered = value;
			}
		}

		// Token: 0x17000417 RID: 1047
		// (get) Token: 0x060015B5 RID: 5557 RVA: 0x00326590 File Offset: 0x00324790
		// (set) Token: 0x060015B4 RID: 5556 RVA: 0x00326587 File Offset: 0x00324787
		public virtual List<TAutomaticProperty> AutomaticProperties
		{
			get
			{
				return this._automaticProperties;
			}
			set
			{
				this._automaticProperties = value;
			}
		}

		// Token: 0x17000418 RID: 1048
		// (get) Token: 0x060015B6 RID: 5558 RVA: 0x00326598 File Offset: 0x00324798
		// (set) Token: 0x060015B7 RID: 5559 RVA: 0x003265A0 File Offset: 0x003247A0
		public virtual TExpression CheckCondition
		{
			get
			{
				return this._checkCondition;
			}
			set
			{
				this._checkCondition = value;
			}
		}

		// Token: 0x17000419 RID: 1049
		// (get) Token: 0x060015B8 RID: 5560 RVA: 0x003265A9 File Offset: 0x003247A9
		// (set) Token: 0x060015B9 RID: 5561 RVA: 0x003265B1 File Offset: 0x003247B1
		public virtual TObjectNameList ColumnList
		{
			get
			{
				return this._columnList;
			}
			set
			{
				this._columnList = value;
			}
		}

		// Token: 0x1700041A RID: 1050
		// (get) Token: 0x060015BA RID: 5562 RVA: 0x003265BA File Offset: 0x003247BA
		// (set) Token: 0x060015BB RID: 5563 RVA: 0x003265C2 File Offset: 0x003247C2
		public virtual List<TIndexColName> IndexCols
		{
			get
			{
				return this._indexCols;
			}
			set
			{
				this._indexCols = value;
			}
		}

		// Token: 0x060015BC RID: 5564 RVA: 0x003265CB File Offset: 0x003247CB
		public override void init(object arg1)
		{
			if (arg1 is TExpression)
			{
				this._checkCondition = (TExpression)arg1;
				return;
			}
			if (arg1 is TObjectNameList)
			{
				this._columnList = (TObjectNameList)arg1;
				return;
			}
			if (arg1 is List<TIndexColName>)
			{
				this._indexCols = (List<TIndexColName>)arg1;
			}
		}

		// Token: 0x1700041B RID: 1051
		// (get) Token: 0x060015BE RID: 5566 RVA: 0x00326614 File Offset: 0x00324814
		// (set) Token: 0x060015BD RID: 5565 RVA: 0x0032660B File Offset: 0x0032480B
		public virtual TObjectNameList ReferencedColumnList
		{
			get
			{
				return this._referencedColumnList;
			}
			set
			{
				this._referencedColumnList = value;
			}
		}

		// Token: 0x1700041C RID: 1052
		// (get) Token: 0x060015C0 RID: 5568 RVA: 0x00326625 File Offset: 0x00324825
		// (set) Token: 0x060015BF RID: 5567 RVA: 0x0032661C File Offset: 0x0032481C
		public virtual TObjectName ReferencedObject
		{
			get
			{
				return this._referencedObject;
			}
			set
			{
				this._referencedObject = value;
			}
		}

		// Token: 0x1700041D RID: 1053
		// (get) Token: 0x060015C2 RID: 5570 RVA: 0x00326636 File Offset: 0x00324836
		// (set) Token: 0x060015C1 RID: 5569 RVA: 0x0032662D File Offset: 0x0032482D
		public virtual TExpression Increment
		{
			get
			{
				return this._increment;
			}
			set
			{
				this._increment = value;
			}
		}

		// Token: 0x1700041E RID: 1054
		// (get) Token: 0x060015C4 RID: 5572 RVA: 0x00326647 File Offset: 0x00324847
		// (set) Token: 0x060015C3 RID: 5571 RVA: 0x0032663E File Offset: 0x0032483E
		public virtual TExpression Seed
		{
			get
			{
				return this._seed;
			}
			set
			{
				this._seed = value;
			}
		}

		// Token: 0x060015C5 RID: 5573 RVA: 0x0032664F File Offset: 0x0032484F
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x060015C6 RID: 5574 RVA: 0x0032665F File Offset: 0x0032485F
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x060015C7 RID: 5575 RVA: 0x00326670 File Offset: 0x00324870
		public override void doParse(TCustomSqlStatement psql, ESqlClause plocation)
		{
			EConstraintType constraint_type = this.Constraint_type;
			if (constraint_type == EConstraintType.foreign_key || constraint_type == EConstraintType.reference)
			{
				TTable ttable = null;
				if (this._referencedObject != null)
				{
					this._referencedObject.ObjectType = 3;
					ttable = new TTable(this._referencedObject);
					ttable.startToken = this._referencedObject.startToken;
					ttable.endToken = this._referencedObject.endToken;
					ttable.GSharpSqlParser = this._referencedObject.GSharpSqlParser;
					ttable.EffectType = ETableEffectType.tetConstraintReference;
					ttable.TableType = ETableSource.objectname;
					psql.addToTables(ttable);
				}
				if (this._referencedColumnList != null)
				{
					for (int i = 0; i < this._referencedColumnList.size(); i++)
					{
						this._referencedColumnList.getObjectName(i).Location = ESqlClause.constraintRef;
						ttable.LinkedColumns.addObjectName(this._referencedColumnList.getObjectName(i));
					}
				}
			}
		}

		// Token: 0x0400173D RID: 5949
		private TObjectName _forName;

		// Token: 0x0400173E RID: 5950
		private List<TMySQLIndexOption> _indexOptionList;

		// Token: 0x0400173F RID: 5951
		private EConstraintType _constraint_type;

		// Token: 0x04001740 RID: 5952
		private TObjectName _constraintName;

		// Token: 0x04001741 RID: 5953
		private List<TKeyAction> _keyActions;

		// Token: 0x04001742 RID: 5954
		private TConstant _constraintComment;

		// Token: 0x04001743 RID: 5955
		private int _constraintLevel = 2;

		// Token: 0x04001744 RID: 5956
		private TExpression _defaultExpression;

		// Token: 0x04001745 RID: 5957
		private bool _clustered;

		// Token: 0x04001746 RID: 5958
		private bool _nonClustered;

		// Token: 0x04001747 RID: 5959
		private TObjectNameList _columnList;

		// Token: 0x04001748 RID: 5960
		private TExpression _checkCondition;

		// Token: 0x04001749 RID: 5961
		private List<TAutomaticProperty> _automaticProperties;

		// Token: 0x0400174A RID: 5962
		private List<TIndexColName> _indexCols;

		// Token: 0x0400174B RID: 5963
		private TObjectName _referencedObject;

		// Token: 0x0400174C RID: 5964
		private TObjectNameList _referencedColumnList;

		// Token: 0x0400174D RID: 5965
		private TExpression _seed;

		// Token: 0x0400174E RID: 5966
		private TExpression _increment;
	}
}
